<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
    <script>
        var inp = document.querySelector("input")
        /* 键盘抬起 */
        inp.onkeyup = function(){console.log("键盘抬起");}
        /* 键盘按下 */
        inp.onkeydown = function(){console.log("键盘按下 down");}
        /* 键盘按下 => 对一些功能键不认得*/
        inp.onkeypress = function(){console.log("键盘按下 press");}
    </script>
</body>
</html>